
/*
 * @(#)MaintFormGroupForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.form.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.form.bean.FormGroup;
import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;

/**
  MaintFormGroupForm.java

  This class is the for web form purpose.

  @author          Tony Chen
  @company         DCIVision Limited
  @creation date   18/01/2004
  @version         $Revision: 1.3 $
*/

public class MaintFormGroupForm extends com.dcivision.setup.web.AbstractActionPermissionForm {

  public static final String REVISION = "$Revision: 1.3 $";

  private String groupName = null;
  private String description = null;

  public MaintFormGroupForm() {
    super();
  }

  public String getGroupName() {
    return(this.groupName);
  }

  public void setGroupName(String groupName) {
    this.groupName = groupName;
  }

  public String getDescription() {
    return(this.description);
  }

  public void setDescription(String description) {
    this.description = description;
  }
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setGroupName(null);
    this.setDescription(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    FormGroup tmpFormGroup = new FormGroup();
    tmpFormGroup.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpFormGroup.setGroupName(this.getGroupName());
    tmpFormGroup.setDescription(this.getDescription());
    tmpFormGroup.setRecordStatus(this.getRecordStatus());
    tmpFormGroup.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpFormGroup.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpFormGroup.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpFormGroup.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpFormGroup.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpFormGroup;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    FormGroup tmpFormGroup = (FormGroup)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpFormGroup.getID()));
    this.setGroupName(tmpFormGroup.getGroupName());
    this.setDescription(tmpFormGroup.getDescription());
    this.setRecordStatus(tmpFormGroup.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpFormGroup.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpFormGroup.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpFormGroup.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpFormGroup.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpFormGroup.getUpdateDate()));
  }
}
